#{extends 'main.html' /}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="pt-BR">
  <head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  </head>
  <body>

<h2>Alteração de Usuário</h2>
#{form @alteraUsuario(),method:'POST',class:'form-horizontal'}
<fieldset>
<legend></legend>

        #{field 'usuario.id'}
          <div class="control-group ${errors.forKey(field.name)?'error':''}">
            <div class="controls">
              <input type="hidden" name="${field.name}" value="${field.value}" class="input-medium">
              <span class="help-inline">${errors.forKey(field.name)}</span>
            </div>
          </div>
          #{/field}
          #{field 'usuario.nome'}
          <div class="control-group ${errors.forKey(field.name)?'error':''}">
            <label for="${field.name}" class="control-label">Nome</label>
            <div class="controls">
              <input type="text" name="${field.name}" value="${field.value}" class="input-medium">
              <span class="help-inline">${errors.forKey(field.name)}</span>
            </div>
          </div>
          #{/field}
          
          #{field 'usuario.telefone'}
          <div class="control-group ${errors.forKey(field.name)?'error':''}">
            <label for="${field.name}" class="control-label">Telefone</label>
            <div class="controls">
              <input type="text" name="${field.name}" value="${field.value}" class="input-medium">
              <span class="help-inline">${errors.forKey(field.name)}</span>
            </div>
          </div>
          #{/field}

          
          #{field 'usuario.endereco'}
          <div class="control-group ${errors.forKey(field.name)?'error':''}">
            <label for="${field.name}" class="control-label">Endereço</label>
            <div class="controls">
              <input type="text" name="${field.name}" value="${field.value}" class="input-medium">
              <span class="help-inline">${errors.forKey(field.name)}</span>
            </div>
          </div>
          #{/field}
          
          #{field 'usuario.cpfCnpj'}
          <div class="control-group ${errors.forKey(field.name)?'error':''}">
            <label for="${field.name}" class="control-label">CPF ou CNPJ</label>
            <div class="controls">
              <input disabled = "disabled" type="text" name="${field.name}" value="${field.value}" class="input-medium">
              <span class="help-inline">${errors.forKey(field.name)}</span>
            </div>
          </div>
          #{/field}
                    
          #{field 'usuario.email'}
          <div class="control-group ${errors.forKey(field.name)?'error':''}">
            <label for="${field.name}" class="control-label">Email</label>
            <div class="controls">
              <input disabled = "disabled" type="text" name="${field.name}" value="${field.value}" class="input-medium">
              <span class="help-inline">${errors.forKey(field.name)}</span>
            </div>
          </div>
          #{/field}
                          
          #{field 'usuario.senha'}
          <div class="control-group ${errors.forKey(field.name)?'error':''}">
            <label for="${field.name}" class="control-label">Senha</label>
            <div class="controls">
              <input disabled = 'disabled' type="password" name="${field.name}" value="${field.value}" class="input-medium">
              <span class="help-inline">${errors.forKey(field.name)}</span>
            </div>
          </div>
          #{/field}
                    		<a href="javascript: confirma_excluir()" style="float:right;">Excluir Conta</a>

                    		<br />
          <div class="form-actions">
            <button class="btn btn-primary" type="submit">Alterar Dados</button>
            <button class="btn" type="reset">Desfazer</button>
          </div>
        </fieldset>
#{/form}
<div id='excluir'>
<form action="/usuarios/deletar", method:'POST', name='excluir'></form> 
</div>
<script type="text/javascript">
function confirma_excluir()
{
	var r = confirm("Esta operacao nao podera ser desfeita e todos seus anuncios serao excluidos. Deseja continuar?");
	if (r == true) 
	{
		alert("OK! Seus dados serao excluidos.");
			document.forms["excluir"].submit();

	}else{
	alert("Seus dados NAO serao excluidos.");

}
}

</script>
</body>
</html>